using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class RTDInfo
    {
		#region Local Variable
		public enum Field
		{
			TVC_DB,
			LOOKUP,
			CREATEDBY,
			MODIFIEDBY,
			CREATEDDATE,
			MODIFIEDDATE,
			CODE,
			RPT_TYPE,
			DESCRIPTION
		}
		private String _TVC_DB;
		private String _LOOKUP;
		private String _CREATEDBY;
		private String _MODIFIEDBY;
		private Int32 _CREATEDDATE;
		private Int32 _MODIFIEDDATE;
		private String _CODE;
		private String _RPT_TYPE;
		private String _DESCRIPTION;
		
		public String TVC_DB{	get{ return _TVC_DB;} set{_TVC_DB = value;} }
		public String LOOKUP{	get{ return _LOOKUP;} set{_LOOKUP = value;} }
		public String CREATEDBY{	get{ return _CREATEDBY;} set{_CREATEDBY = value;} }
		public String MODIFIEDBY{	get{ return _MODIFIEDBY;} set{_MODIFIEDBY = value;} }
		public Int32 CREATEDDATE{	get{ return _CREATEDDATE;} set{_CREATEDDATE = value;} }
		public Int32 MODIFIEDDATE{	get{ return _MODIFIEDDATE;} set{_MODIFIEDDATE = value;} }
		public String CODE{	get{ return _CODE;} set{_CODE = value;} }
		public String RPT_TYPE{	get{ return _RPT_TYPE;} set{_RPT_TYPE = value;} }
		public String DESCRIPTION{	get{ return _DESCRIPTION;} set{_DESCRIPTION = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public RTDInfo()
		{
			_TVC_DB = "";
			_LOOKUP = "";
			_CREATEDBY = "";
			_MODIFIEDBY = "";
			_CREATEDDATE = 0;
			_MODIFIEDDATE = 0;
			_CODE = "";
			_RPT_TYPE = "";
			_DESCRIPTION = "";
		}
		public RTDInfo(
		String TVC_DB,
		String LOOKUP,
		String CREATEDBY,
		String MODIFIEDBY,
		Int32 CREATEDDATE,
		Int32 MODIFIEDDATE,
		String CODE,
		String RPT_TYPE,
		String DESCRIPTION
		)
		{
			_TVC_DB = TVC_DB;
			_LOOKUP = LOOKUP;
			_CREATEDBY = CREATEDBY;
			_MODIFIEDBY = MODIFIEDBY;
			_CREATEDDATE = CREATEDDATE;
			_MODIFIEDDATE = MODIFIEDDATE;
			_CODE = CODE;
			_RPT_TYPE = RPT_TYPE;
			_DESCRIPTION = DESCRIPTION;
		}
		public RTDInfo(DataRow dr)
		{
			if (dr != null)
			{
				_TVC_DB = dr[Field.TVC_DB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TVC_DB.ToString()]);
				_LOOKUP = dr[Field.LOOKUP.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOOKUP.ToString()]);
				_CREATEDBY = dr[Field.CREATEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEDBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDDATE = dr[Field.CREATEDDATE.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.CREATEDDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.MODIFIEDDATE.ToString()]);
				_CODE = dr[Field.CODE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CODE.ToString()]);
				_RPT_TYPE = dr[Field.RPT_TYPE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.RPT_TYPE.ToString()]);
				_DESCRIPTION = dr[Field.DESCRIPTION.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DESCRIPTION.ToString()]);
			}
		}
		public RTDInfo(RTDInfo objEntr)
		{			
			_TVC_DB = objEntr.TVC_DB;			
			_LOOKUP = objEntr.LOOKUP;			
			_CREATEDBY = objEntr.CREATEDBY;			
			_MODIFIEDBY = objEntr.MODIFIEDBY;			
			_CREATEDDATE = objEntr.CREATEDDATE;			
			_MODIFIEDDATE = objEntr.MODIFIEDDATE;			
			_CODE = objEntr.CODE;			
			_RPT_TYPE = objEntr.RPT_TYPE;			
			_DESCRIPTION = objEntr.DESCRIPTION;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("RTD");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.TVC_DB.ToString(), typeof(String)),
				new DataColumn(Field.LOOKUP.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDBY.ToString(), typeof(String)),
				new DataColumn(Field.MODIFIEDBY.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDDATE.ToString(), typeof(Int32)),
				new DataColumn(Field.MODIFIEDDATE.ToString(), typeof(Int32)),
				new DataColumn(Field.CODE.ToString(), typeof(String)),
				new DataColumn(Field.RPT_TYPE.ToString(), typeof(String)),
				new DataColumn(Field.DESCRIPTION.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.TVC_DB.ToString()] = _TVC_DB;
			row[Field.LOOKUP.ToString()] = _LOOKUP;
			row[Field.CREATEDBY.ToString()] = _CREATEDBY;
			row[Field.MODIFIEDBY.ToString()] = _MODIFIEDBY;
			row[Field.CREATEDDATE.ToString()] = _CREATEDDATE;
			row[Field.MODIFIEDDATE.ToString()] = _MODIFIEDDATE;
			row[Field.CODE.ToString()] = _CODE;
			row[Field.RPT_TYPE.ToString()] = _RPT_TYPE;
			row[Field.DESCRIPTION.ToString()] = _DESCRIPTION;
			return row;
		}
        #endregion InitTable
    }
}
